package User;

import Operation.*;

import java.util.Scanner;

/**
 * 普通用户类：普通用户的菜单显示和功能
 */
public class NormalUser extends User{

    public NormalUser(String name) {
        super(name);
        iOperations = new IOperation[]{
                new ExitOperation(),
                new SearchOperation(),
                new BorrowOperation(),
                new ReturnOperation(),
        };
    }

    {
        System.out.println("Hi," + name +"!" + " 欢迎来到图书小练习！");
    }

    @Override
    public int menu() {
        System.out.println("+----------- 菜单 -----------+");
        System.out.println("|         1. 查找图书         |");
        System.out.println("|         2. 借阅图书         |");
        System.out.println("|         3. 归还图书         |");
        System.out.println("|         0. 退出系统         |");
        System.out.println("+----------------------------+");
        System.out.print("请选择：");
        Scanner scanner = new Scanner(System.in);
        int selection = scanner.nextInt();
        return selection;
    }
}
